<?php

namespace App\Http\Controllers\Backend;
use App\Http\Controllers\BaseController;
use App\Http\Middleware\AdminAuth;
use App\Params\Backend\OrderListParams;
use App\Services\Sales\OrderService;
use App\Traits\VerifyRequestParam;
use Illuminate\Http\Request;
/**
 * 订单控制器
 *
 * @package App\Http\Controllers\H5
 * @author WangBin
 * @date 2021-06/11
 */
class OrderController extends BaseController
{
    use VerifyRequestParam;

    public function __construct()
    {

    }

    /**
     * 订单列表
     *
     * @param Request $request
     * @return
     */
    public function getList()
    {
        $param = OrderListParams::create();
        $ret = OrderService::getInstance()->getAdminOrderList($param);
        return $this->success($ret);
    }

    /**
     * 订单详情
     *
     * @return \Illuminate\Http\JsonResponse
     * @throws
     */
    public function get()
    {
        $orderId = $this->verifyInteger('order_id');
        $ret = OrderService::getInstance()->getAdminOrder($orderId);
        return $this->success($ret);
    }

    /**
     * 获取订单初始化信息
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function init()
    {
        return $this->success(OrderService::getInstance()->getInit());
    }
}
